<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <!--      <el-form-item label="用户名" prop="username">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.username"-->
      <!--          placeholder="请输入用户名"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />
            </el-form-item>-->
      <el-form-item label="商家姓名" prop="name">
        <el-input
          v-model="queryParams.name"
          placeholder="请输入商家姓名"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <!--      <el-form-item label="商家电话" prop="tel">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.tel"-->
      <!--          placeholder="请输入商家电话"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="商家地址" prop="address">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.address"-->
      <!--          placeholder="请输入商家地址"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="头像" prop="img">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.img"-->
      <!--          placeholder="请输入头像"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="商户二维码" prop="code">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.code"-->
      <!--          placeholder="请输入商户二维码"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否锁定   1否     2是" prop="locks">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.locks"-->
      <!--          placeholder="请输入是否锁定   1否     2是"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="二级域名" prop="domain">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.domain"-->
      <!--          placeholder="请输入二级域名"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="独立域名" prop="domainurl">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.domainurl"-->
      <!--          placeholder="请输入独立域名"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否缴纳保证金     0 为已经缴纳     1代表未缴纳" prop="bond">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.bond"-->
      <!--          placeholder="请输入是否缴纳保证金     0 为已经缴纳     1代表未缴纳"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否领用设备  0已经领用    1位未领用   " prop="equipment">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.equipment"-->
      <!--          placeholder="请输入是否领用设备  0已经领用    1位未领用   "-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="折扣率" prop="discount">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.discount"-->
      <!--          placeholder="请输入折扣率"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="省" prop="shengId">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.shengId"-->
      <!--          placeholder="请输入省"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="市" prop="cityId">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.cityId"-->
      <!--          placeholder="请输入市"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="县" prop="areaId">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.areaId"-->
      <!--          placeholder="请输入县"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="上次登录时间" prop="lasttime">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.lasttime"-->
      <!--          placeholder="请输入上次登录时间"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="创建时间" prop="time">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.time"-->
      <!--          placeholder="请输入创建时间"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="商户预览二维码" prop="ylcode">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.ylcode"-->
      <!--          placeholder="请输入商户预览二维码"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="修改j价格对应的值" prop="savepricenumber">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.savepricenumber"-->
      <!--          placeholder="请输入修改j价格对应的值"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="备案号" prop="record">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.record"-->
      <!--          placeholder="请输入备案号"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否独立域名" prop="typeyrl">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.typeyrl"-->
      <!--          placeholder="请输入是否独立域名"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="网站名称" prop="titlename">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.titlename"-->
      <!--          placeholder="请输入网站名称"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="网站关键词" prop="keywords">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.keywords"-->
      <!--          placeholder="请输入网站关键词"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="网站电脑端logo" prop="pclogo">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.pclogo"-->
      <!--          placeholder="请输入网站电脑端logo"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="网站手机端logo" prop="mobilelogo">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.mobilelogo"-->
      <!--          placeholder="请输入网站手机端logo"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="浏览器导航ico图标" prop="icologo">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.icologo"-->
      <!--          placeholder="请输入浏览器导航ico图标"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="电脑端背景图" prop="pcbg">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.pcbg"-->
      <!--          placeholder="请输入电脑端背景图"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="链接式代码" prop="urldaima">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.urldaima"-->
      <!--          placeholder="请输入链接式代码"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="1订单短信、2查价短信、3访问量短信" prop="noticemsg">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.noticemsg"-->
      <!--          placeholder="请输入1订单短信、2查价短信、3访问量短信"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="客服微信" prop="servicewechat">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.servicewechat"-->
      <!--          placeholder="请输入客服微信"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="接受短信号码" prop="msgTel">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.msgTel"-->
      <!--          placeholder="请输入接受短信号码"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="是否共享轮播图和文章 1共享   2 不共享" prop="isSharing">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.isSharing"-->
      <!--          placeholder="请输入是否共享轮播图和文章 1共享   2 不共享"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="供应商是否展示总后台的号码   1否    2是" prop="isHaoyuan">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.isHaoyuan"-->
      <!--          placeholder="请输入供应商是否展示总后台的号码   1否    2是"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="所属供应商" prop="supplierId">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.supplierId"-->
      <!--          placeholder="请输入所属供应商"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <!--      <el-form-item label="微信openid" prop="openid">-->
      <!--        <el-input-->
      <!--          v-model="queryParams.openid"-->
      <!--          placeholder="请输入微信openid"-->
      <!--          clearable-->
      <!--          @keyup.enter.native="handleQuery"-->
      <!--        />-->
      <!--      </el-form-item>-->
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['hmk:business:add']"
        >新增
        </el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['hmk:business:edit']"
        >修改
        </el-button>
      </el-col>
      <!--      <el-col :span="1.5">-->
      <!--        <el-button-->
      <!--          type="danger"-->
      <!--          plain-->
      <!--          icon="el-icon-delete"-->
      <!--          size="mini"-->
      <!--          :disabled="multiple"-->
      <!--          @click="handleDelete"-->
      <!--          v-hasPermi="['hmk:business:remove']"-->
      <!--        >删除</el-button>-->
      <!--      </el-col>-->
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['hmk:business:export']"
        >导出
        </el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="businessList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center"/>
      <el-table-column label="主键" align="center" prop="id"/>
      <el-table-column label="用户名" align="center" prop="username"/>
      <el-table-column label="商家姓名" align="center" prop="name"/>
      <el-table-column label="商家电话" align="center" prop="tel"/>
      <!--      <el-table-column label="商家地址" align="center" prop="address" />-->
      <!--      <el-table-column label="头像" align="center" prop="img" />-->
      <!--      <el-table-column label="商户二维码" align="center" prop="code" />-->
      <!--      <el-table-column label="是否锁定   1否     2是" align="center" prop="locks" />-->
      <!--      <el-table-column label="二级域名" align="center" prop="domain" />-->
      <!--      <el-table-column label="独立域名" align="center" prop="domainurl" />-->
      <!--      <el-table-column label="是否缴纳保证金     0 为已经缴纳     1代表未缴纳" align="center" prop="bond" />-->
      <!--      <el-table-column label="是否领用设备  0已经领用    1位未领用   " align="center" prop="equipment" />-->
      <!--      <el-table-column label="折扣率" align="center" prop="discount" />-->
      <!--      <el-table-column label="省" align="center" prop="shengId" />-->
      <!--      <el-table-column label="市" align="center" prop="cityId" />-->
      <!--      <el-table-column label="县" align="center" prop="areaId" />-->
      <!--      <el-table-column label="上次登录时间" align="center" prop="lasttime" />-->
      <!--      <el-table-column label="创建时间" align="center" prop="time" />-->
      <!--      <el-table-column label="商户预览二维码" align="center" prop="ylcode" />-->
      <!--      <el-table-column label="修改价格类型" align="center" prop="savepricetype" />-->
      <!--      <el-table-column label="修改j价格对应的值" align="center" prop="savepricenumber" />-->
      <!--      <el-table-column label="备案号" align="center" prop="record" />-->
      <!--      <el-table-column label="是否独立域名" align="center" prop="typeyrl" />-->
      <!--      <el-table-column label="网站名称" align="center" prop="titlename" />-->
      <!--      <el-table-column label="网站关键词" align="center" prop="keywords" />-->
      <!--      <el-table-column label="网站电脑端logo" align="center" prop="pclogo" />-->
      <!--      <el-table-column label="网站手机端logo" align="center" prop="mobilelogo" />-->
      <!--      <el-table-column label="浏览器导航ico图标" align="center" prop="icologo" />-->
      <!--      <el-table-column label="电脑端背景图" align="center" prop="pcbg" />-->
      <!--      <el-table-column label="网站简介" align="center" prop="description" />-->
      <!--      <el-table-column label="手机端网站统计代码商桥这些" align="center" prop="mobiledaima" />-->
      <!--      <el-table-column label="PC端网站统计代码商桥这些" align="center" prop="pcdaima" />-->
      <!--      <el-table-column label="关于我们" align="center" prop="guanyuwomen" />-->
      <!--      <el-table-column label="联系我们" align="center" prop="lianxiwomen" />-->
      <!--      <el-table-column label="链接式代码" align="center" prop="urldaima" />-->
      <!--      <el-table-column label="1订单短信、2查价短信、3访问量短信" align="center" prop="noticemsg" />-->
      <!--      <el-table-column label="客服微信" align="center" prop="servicewechat" />-->
      <!--      <el-table-column label="接受短信号码" align="center" prop="msgTel" />-->
      <!--      <el-table-column label="是否共享轮播图和文章 1共享   2 不共享" align="center" prop="isSharing" />-->
      <!--      <el-table-column label="轮播图" align="center" prop="banner" />-->
      <!--      <el-table-column label="商户类型   1分销商户    2供应商户    3高级商户" align="center" prop="type" />-->
      <!--      <el-table-column label="供应商是否展示总后台的号码   1否    2是" align="center" prop="isHaoyuan" />-->
      <!--      <el-table-column label="所属供应商" align="center" prop="supplierId" />-->
      <!--      <el-table-column label="微信openid" align="center" prop="openid" />-->
      <!--      <el-table-column label="供应商户生成的小程序码" align="center" prop="sjlhqrcode" />-->
      <!--      <el-table-column label="普通商户和高级商户生成的小程序码" align="center" prop="hmkqrcode" />-->
      <!--      <el-table-column label="重庆手机靓号小程序推广海报" align="center" prop="sjlhposter" />-->
      <!--      <el-table-column label="号码库小程序推广海报" align="center" prop="hmkposter" />-->
      <!--      <el-table-column label="供应商户获取微信订阅消息二维码" align="center" prop="templatecode" />-->
      <!--&lt;!&ndash;      <el-table-column label="对应权限分销号码，1导出号码，2一键复制我的号码" align="center" prop="jurisdiction" />-->
      <!--      <el-table-column label="公安备案号代码" align="center" prop="gonganbeian" />-->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['hmk:business:edit']"
          >修改
          </el-button>
          <!--          <el-button-->
          <!--            size="mini"-->
          <!--            type="text"-->
          <!--            icon="el-icon-delete"-->
          <!--            @click="handleDelete(scope.row)"-->
          <!--            v-hasPermi="['hmk:business:remove']"-->
          <!--          >删除</el-button>-->
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改商家对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="用户名" prop="username">
          <el-input v-model="form.username" placeholder="请输入用户名"/>
        </el-form-item>
        <el-form-item label="商家姓名" prop="name">
          <el-input v-model="form.name" placeholder="请输入商家姓名"/>
        </el-form-item>
        <el-form-item label="商家电话" prop="tel">
          <el-input v-model="form.tel" placeholder="请输入商家电话"/>
        </el-form-item>
        <el-form-item label="商家地址" prop="address">
          <el-input v-model="form.address" placeholder="请输入商家地址"/>
        </el-form-item>
        <el-form-item label="头像" prop="img">
          <el-input v-model="form.img" placeholder="请输入头像"/>
        </el-form-item>
        <el-form-item label="商户二维码" prop="code">
          <el-input v-model="form.code" placeholder="请输入商户二维码"/>
        </el-form-item>
        <el-form-item label="是否锁定   1否     2是" prop="locks">
          <el-input v-model="form.locks" placeholder="请输入是否锁定   1否     2是"/>
        </el-form-item>
        <el-form-item label="二级域名" prop="domain">
          <el-input v-model="form.domain" placeholder="请输入二级域名"/>
        </el-form-item>
        <el-form-item label="独立域名" prop="domainurl">
          <el-input v-model="form.domainurl" placeholder="请输入独立域名"/>
        </el-form-item>
        <el-form-item label="是否缴纳保证金     0 为已经缴纳     1代表未缴纳" prop="bond">
          <el-input v-model="form.bond" placeholder="请输入是否缴纳保证金     0 为已经缴纳     1代表未缴纳"/>
        </el-form-item>
        <el-form-item label="是否领用设备  0已经领用    1位未领用   " prop="equipment">
          <el-input v-model="form.equipment" placeholder="请输入是否领用设备  0已经领用    1位未领用   "/>
        </el-form-item>
        <el-form-item label="折扣率" prop="discount">
          <el-input v-model="form.discount" placeholder="请输入折扣率"/>
        </el-form-item>
        <el-form-item label="省" prop="shengId">
          <el-input v-model="form.shengId" placeholder="请输入省"/>
        </el-form-item>
        <el-form-item label="市" prop="cityId">
          <el-input v-model="form.cityId" placeholder="请输入市"/>
        </el-form-item>
        <el-form-item label="县" prop="areaId">
          <el-input v-model="form.areaId" placeholder="请输入县"/>
        </el-form-item>
        <el-form-item label="上次登录时间" prop="lasttime">
          <el-input v-model="form.lasttime" placeholder="请输入上次登录时间"/>
        </el-form-item>
        <el-form-item label="创建时间" prop="time">
          <el-input v-model="form.time" placeholder="请输入创建时间"/>
        </el-form-item>
        <el-form-item label="商户预览二维码" prop="ylcode">
          <el-input v-model="form.ylcode" placeholder="请输入商户预览二维码"/>
        </el-form-item>
        <el-form-item label="修改j价格对应的值" prop="savepricenumber">
          <el-input v-model="form.savepricenumber" placeholder="请输入修改j价格对应的值"/>
        </el-form-item>
        <el-form-item label="备案号" prop="record">
          <el-input v-model="form.record" placeholder="请输入备案号"/>
        </el-form-item>
        <el-form-item label="是否独立域名" prop="typeyrl">
          <el-input v-model="form.typeyrl" placeholder="请输入是否独立域名"/>
        </el-form-item>
        <el-form-item label="网站名称" prop="titlename">
          <el-input v-model="form.titlename" placeholder="请输入网站名称"/>
        </el-form-item>
        <el-form-item label="网站关键词" prop="keywords">
          <el-input v-model="form.keywords" placeholder="请输入网站关键词"/>
        </el-form-item>
        <el-form-item label="网站电脑端logo" prop="pclogo">
          <el-input v-model="form.pclogo" placeholder="请输入网站电脑端logo"/>
        </el-form-item>
        <el-form-item label="网站手机端logo" prop="mobilelogo">
          <el-input v-model="form.mobilelogo" placeholder="请输入网站手机端logo"/>
        </el-form-item>
        <el-form-item label="浏览器导航ico图标" prop="icologo">
          <el-input v-model="form.icologo" placeholder="请输入浏览器导航ico图标"/>
        </el-form-item>
        <el-form-item label="电脑端背景图" prop="pcbg">
          <el-input v-model="form.pcbg" placeholder="请输入电脑端背景图"/>
        </el-form-item>
        <el-form-item label="网站简介" prop="description">
          <el-input v-model="form.description" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="手机端网站统计代码商桥这些" prop="mobiledaima">
          <el-input v-model="form.mobiledaima" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="PC端网站统计代码商桥这些" prop="pcdaima">
          <el-input v-model="form.pcdaima" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="关于我们" prop="guanyuwomen">
          <el-input v-model="form.guanyuwomen" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="联系我们" prop="lianxiwomen">
          <el-input v-model="form.lianxiwomen" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="链接式代码" prop="urldaima">
          <el-input v-model="form.urldaima" placeholder="请输入链接式代码"/>
        </el-form-item>
        <el-form-item label="1订单短信、2查价短信、3访问量短信" prop="noticemsg">
          <el-input v-model="form.noticemsg" placeholder="请输入1订单短信、2查价短信、3访问量短信"/>
        </el-form-item>
        <el-form-item label="客服微信" prop="servicewechat">
          <el-input v-model="form.servicewechat" placeholder="请输入客服微信"/>
        </el-form-item>
        <el-form-item label="接受短信号码" prop="msgTel">
          <el-input v-model="form.msgTel" placeholder="请输入接受短信号码"/>
        </el-form-item>
        <el-form-item label="是否共享轮播图和文章 1共享   2 不共享" prop="isSharing">
          <el-input v-model="form.isSharing" placeholder="请输入是否共享轮播图和文章 1共享   2 不共享"/>
        </el-form-item>
        <el-form-item label="轮播图" prop="banner">
          <el-input v-model="form.banner" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="供应商是否展示总后台的号码   1否    2是" prop="isHaoyuan">
          <el-input v-model="form.isHaoyuan" placeholder="请输入供应商是否展示总后台的号码   1否    2是"/>
        </el-form-item>
        <el-form-item label="所属供应商" prop="supplierId">
          <el-input v-model="form.supplierId" placeholder="请输入所属供应商"/>
        </el-form-item>
        <el-form-item label="微信openid" prop="openid">
          <el-input v-model="form.openid" placeholder="请输入微信openid"/>
        </el-form-item>
        <el-form-item label="供应商户生成的小程序码" prop="sjlhqrcode">
          <el-input v-model="form.sjlhqrcode" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="普通商户和高级商户生成的小程序码" prop="hmkqrcode">
          <el-input v-model="form.hmkqrcode" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="重庆手机靓号小程序推广海报" prop="sjlhposter">
          <el-input v-model="form.sjlhposter" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="号码库小程序推广海报" prop="hmkposter">
          <el-input v-model="form.hmkposter" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="供应商户获取微信订阅消息二维码" prop="templatecode">
          <el-input v-model="form.templatecode" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="对应权限
分销号码
，1导出号码
，2一键复制
我的号码" prop="jurisdiction">
          <el-input v-model="form.jurisdiction" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
        <el-form-item label="公安备案号代码" prop="gonganbeian">
          <el-input v-model="form.gonganbeian" type="textarea" placeholder="请输入内容"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import {addBusiness, delBusiness, getBusiness, listBusiness, updateBusiness} from "@/api/hmk/business";

export default {
  name: "Business",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 商家表格数据
      businessList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        username: null,
        name: null,
        tel: null,
        address: null,
        img: null,
        code: null,
        locks: null,
        domain: null,
        domainurl: null,
        bond: null,
        equipment: null,
        discount: null,
        shengId: null,
        cityId: null,
        areaId: null,
        lasttime: null,
        time: null,
        ylcode: null,
        savepricetype: null,
        savepricenumber: null,
        record: null,
        typeyrl: null,
        titlename: null,
        keywords: null,
        pclogo: null,
        mobilelogo: null,
        icologo: null,
        pcbg: null,
        description: null,
        mobiledaima: null,
        pcdaima: null,
        guanyuwomen: null,
        lianxiwomen: null,
        urldaima: null,
        noticemsg: null,
        servicewechat: null,
        msgTel: null,
        isSharing: null,
        banner: null,
        type: null,
        isHaoyuan: null,
        supplierId: null,
        openid: null,
        sjlhqrcode: null,
        hmkqrcode: null,
        sjlhposter: null,
        hmkposter: null,
        templatecode: null,
        jurisdiction: null,
        gonganbeian: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {}
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询商家列表 */
    getList() {
      this.loading = true;
      listBusiness(this.queryParams).then(response => {
        this.businessList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        id: null,
        username: null,
        name: null,
        tel: null,
        address: null,
        img: null,
        code: null,
        locks: null,
        domain: null,
        domainurl: null,
        bond: null,
        equipment: null,
        discount: null,
        shengId: null,
        cityId: null,
        areaId: null,
        lasttime: null,
        time: null,
        ylcode: null,
        savepricetype: null,
        savepricenumber: null,
        record: null,
        typeyrl: null,
        titlename: null,
        keywords: null,
        pclogo: null,
        mobilelogo: null,
        icologo: null,
        pcbg: null,
        description: null,
        mobiledaima: null,
        pcdaima: null,
        guanyuwomen: null,
        lianxiwomen: null,
        urldaima: null,
        noticemsg: null,
        servicewechat: null,
        msgTel: null,
        isSharing: null,
        banner: null,
        type: null,
        isHaoyuan: null,
        supplierId: null,
        openid: null,
        sjlhqrcode: null,
        hmkqrcode: null,
        sjlhposter: null,
        hmkposter: null,
        templatecode: null,
        jurisdiction: null,
        gonganbeian: null
      };
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.id)
      this.single = selection.length !== 1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加商家";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const id = row.id || this.ids
      getBusiness(id).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "修改商家";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          if (this.form.id != null) {
            updateBusiness(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addBusiness(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const ids = row.id || this.ids;
      this.$modal.confirm('是否确认删除商家编号为"' + ids + '"的数据项？').then(function () {
        return delBusiness(ids);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {
      });
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('hmk/business/export', {
        ...this.queryParams
      }, `business_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
